package org.example.struct.array2;

/**
 * @author liyishan
 * @date 2024/3/14 10:20
 * @apiNote
 */

public class Test02789MaxArrayValue {

    public static long maxArrayValue(int[] nums) {
        long sum = nums[nums.length - 1];
        for(int i = nums.length -2;i>=0;i--){
            sum = nums[i] <= sum ? nums[i]+sum:nums[i];
        }
        return sum;
    }
}
